{% extends "base/base.html" %}
{% load i18n %}

{% block inpage_title %}{% trans "Message List" %}{% endblock %}

{% block headercontent %}
<link href="/media/css/message_list.css" rel="stylesheet" type="text/css"></link>
{% endblock %}

{% block extra_menus %}
<a href="{% url folder_list %}">{% trans "Folder List" %}</a>&nbsp;&nbsp;
{% endblock %}
    

{% block contents %}
<h2>{{ folder }}</h2>
<div class="filter_list">
<table>

    <tr>
        <th>{% trans "Tags:" %}</th><td>
{% for flag in folder.flags.keywords %}
    <a href="{% url message_list folder.url %}?flag={{ flag }}">{{ flag }}</a>
{% endfor %} </td>

        <th colspan="2"><a href="{% url message_list folder.url %}">{% trans "No Filter"%}</a></th>
    </tr>
</table>
</div>

{% if page.show %}
<div class="message_page">
<div class="message_page_right">
<p>
{% if page.next %}<a href="{% url message_list folder.url %}?page={{ page.next }}{% if query %};{{ query }}{% endif %}">{% trans "Next &gt;" %}{% endif %}
{% if page.last %}<a href="{% url message_list folder.url %}?page={{ page.last }}{% if query %};{{ query }}{% endif %}">{% trans "Last &gt;|" %}{% endif %}
</div>
<p>
{% if page.first %}<a href="{% url message_list folder.url %}?page={{ page.first }}{% if query %};{{ query }}{% endif %}">{% trans "|&lt; First" %}{% endif %}
{% if page.previous %}<a href="{% url message_list folder.url %}?page={{ page.previous }}{% if query %};{{ query }}{% endif %}">{% trans "&lt; Previous" %}{% endif %}
<div class="clear"></div>
</div>
{% endif %}

<div class="message_list">
{% for message in messages %}
    <div class="{% cycle 'row_a' 'row_b' %}">
    <div class="message">
    
    <div class="date">{{ message.envelope.env_date|date:"Y.m.d H:i" }}</div>
    <div class={% if message.seen %}"seen"{% else %}"not_seen"{% endif %}>
    <p><a href="{% url mailapp-message folder=message.folder.url,uid=message.uid %}">
        {% if message.envelope.env_subject %}{{ message.envelope.env_subject }}
        {% else %}{% trans "(No subject)" %}{% endif %}</a>
    </div>
    <div class="date">{% trans "Size" %}: {{ message.size }} B</div>
    <p>{% trans "From" %}: {% for addr in message.envelope.from_short %}{{addr}}, {% endfor %}
    <p>{% trans "To" %}:{% for addr in message.envelope.to_short %}{{addr}}, {% endfor %}
    </div>
    </div>
{% endfor %}
</div>

{% if page.show %}
<div class="message_page">
<div class="message_page_right">
<p>
{% if page.next %}<a href="{% url message_list folder.url %}?page={{ page.next }}">{% trans "Next &gt;" %}{% endif %}
{% if page.last %}<a href="{% url message_list folder.url %}?page={{ page.last }}">{% trans "Last &gt;|" %}{% endif %}
</div>
<p>
{% if page.first %}<a href="{% url message_list folder.url %}?page={{ page.first }}">{% trans "|&lt; First" %}{% endif %}
{% if page.previous %}<a href="{% url message_list folder.url %}?page={{ page.previous }}">{% trans "&lt; Previous" %}{% endif %}
<div class="clear"></div>
</div>
{% endif %}
{% endblock %}
